package com.zmn.mcc.model;


import org.apache.commons.lang.builder.ToStringBuilder;

import java.io.Serializable;
import java.lang.reflect.Field;

/**
 * @author nowind
 * @since 15/12/29 22:42
 */
public class BaseModel implements Serializable {

    //private static final long serialVersionUID = -5116468685582201715L;

    protected Integer staffId;


    public Integer getStaffId() {
        return staffId;
    }

    public void setStaffId(Integer staffId) {
        this.staffId = staffId;
    }

    /**
     * toString
     */
    @Override
    public String toString() {

        ToStringBuilder builder = new ToStringBuilder(this);

        Field[] fields = this.getClass().getDeclaredFields();
        try {
            for (Field f : fields) {
                f.setAccessible(true);
                builder.append(f.getName(), f.get(this)).append("\n");
            }
        }
        catch (Exception e) { // Suppress
            builder.append("toString builder encounter an error");
        }
        return builder.toString();
    }
}